package Dao;
 
import java.sql.*;
import Dao.DBConn;
import Model.OperateBean;
 
public class OperateDAO {
    private Connection conn; 
    public OperateDAO() throws Exception {
        conn = DBConn.getConnection();
    }
    
   
    // 添加新Operate
    public void insertOperate(OperateBean operate) throws Exception{
    	String sql = "insert into operate(OPERATE_ID,OPERATE_MEMBER_ID,OPERATE_CARD_ID,OPERATE_ACCOUNT_TIME,OPERATE_EXPRIATION_TIME,OPERATE_REMAIN_TIME) values(?,?,?,?,?,?)";
        try{
            PreparedStatement prestmt = conn.prepareStatement(sql);
            prestmt.setInt(1, operate.getID());
            prestmt.setInt(2, operate.getMember_ID());
            prestmt.setInt(3, operate.getCard_ID());
            prestmt.setInt(4, operate.getAccount_time());
            prestmt.setInt(5, operate.getExpriation_time());
            prestmt.setInt(6, operate.getRemain_time());
            
            
            prestmt.execute();
            prestmt.close();
            conn.close();
        }catch (Exception e){
            e.getMessage();
        }
    }
 
}